package models

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

type House struct {
	gorm.Model
	Name    string  `json:"name"`
	Address string  `json:"address"`
	Price   string  `json:"price"`
	Size    float64 `json:"size"`
}

var DB *gorm.DB

func Init() {
	dsn := "root:root@tcp(127.0.0.1:3306)/day10"
	var err error
	DB, err = gorm.Open(mysql.Open(dsn))
	if err != nil {
		panic("数据库连接失败")
	}
}
